﻿namespace Microsoft.SharePoint.Client
{
    using System;
    using System.ComponentModel;

    [ScriptType("SP.FieldComputed", ServerTypeId="{379b8994-f0e7-4c74-a1e6-185eb8600c3c}")]
    public class FieldComputed : Field
    {
        [EditorBrowsable(EditorBrowsableState.Never)]
        public FieldComputed(ClientRuntimeContext Context, ObjectPath ObjectPath) : base(Context, ObjectPath)
        {
        }

        protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader)
        {
            string str;
            bool flag = base.InitOnePropertyFromJson(peekedName, reader);
            if (!flag && (((str = peekedName) != null) && (str == "EnableLookup")))
            {
                flag = true;
                reader.ReadName();
                base.ObjectData.Properties["EnableLookup"] = reader.ReadBoolean();
            }
            return flag;
        }

        [Remote]
        public bool EnableLookup
        {
            get
            {
                base.CheckUninitializedProperty("EnableLookup");
                return (bool) base.ObjectData.Properties["EnableLookup"];
            }
            set
            {
                base.ObjectData.Properties["EnableLookup"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "EnableLookup", value));
                }
            }
        }
    }
}

